Working with the Prizm Platform Services > Prizm Services Overview > PCC Multi-Server Mode > Work Files, Markup Burners & Redaction Creators |
In multi-server mode only, requests for WorkFile, MarkupBurner and RedationCreator resources require an additional bit of data, called an affinity token, to ensure they are routed correctly by the Cloud Entry Point (CEP). The affinity token is a Base64 encoded string that contains encrypted information necessary to route related requestes to the same PCC server. Getting related requests to the same server is critical as the necessary data is cached locally.
In multi-server mode, the PCC RESTful Web Services will automatically generate an affinity token when it receives a POST request for a new WorkFile, MarkupBurner or RedactionCreator resource and return it in the response. Once you have obtained an affinity token, you will need to pass this in with related requests using the "Accusoft-Affinity-Token" HTTP custom header.
The following example request and response sequence demonstrates how an affinity token is used to burn markup into a document. Notice how all requests, (except the first request), use the same affinity token even for subsequent POST requests.
Example |
Copy Code
|
---|---|
// 1. Create first work file, the source PDF document to burn-in markup. POST http://192.168.0.1:18682/PCCIS/V1/WorkFile?FileExtension=pdf Content-Type: application/octet-stream [binary data] 200 OK Content-Type: application/json { "fileId": "5qTYa3gzN9gYUb5SzqUhqg", "affinityToken": "rcqmuB9pAa8+4V7fhO1SXzawy/YMQU1g8lLdNDe5l7w=" } // 2. Create the second work file, the XML markup to burn-in. // Pass in the affinity token generated from the previous request so that this // XML data is stored on the same PCC server. POST http://192.168.0.1:18682/PCCIS/V1/WorkFile?FileExtension=xml Accusoft-Affinity-Token: rcqmuB9pAa8+4V7fhO1SXzawy/YMQU1g8lLdNDe5l7w= Content-Type: application/xml [xml data] 200 OK Content-Type: application/json { "fileId": " o1bLJwFGxf9QGuTkyrOqig", "affinityToken": "rcqmuB9pAa8+4V7fhO1SXzawy/YMQU1g8lLdNDe5l7w=" } // 3. Create the markup burner resource, again on the same PCC server where we created // the work files in the previous requests. POST http://192.168.0.1:18682/PCCIS/V1/MarkupBurner Content-Type: application/json Accusoft-Affinity-Token: rcqmuB9pAa8+4V7fhO1SXzawy/YMQU1g8lLdNDe5l7w= { "input": { "documentFileId": "5qTYa3gzN9gYUb5SzqUhqg", "markupFileId": "o1bLJwFGxf9QGuTkyrOqig" } } 200 OK Content-Type: application/json { "processId": "Rr64ma-U_HseoPrs6y0iiw", "expirationDateTime": "2014-12-03T18:30:49.460Z", "input": { "documentFileId": "5qTYa3gzN9gYUb5SzqUhqg", "markupFileId": " o1bLJwFGxf9QGuTkyrOqig" }, "state": "processing", "percentComplete": 0, "affinityToken": "rcqmuB9pAa8+4V7fhO1SXzawy/YMQU1g8lLdNDe5l7w=" } // 4. Get status of markup burning process until state is “complete”. GET http://192.168.0.1:18682/PCCIS/V1/MarkupBurner/Rr64ma-U_HseoPrs6y0iiw Accusoft-Affinity-Token: rcqmuB9pAa8+4V7fhO1SXzawy/YMQU1g8lLdNDe5l7w= 200 OK Content-Type: application/json { "processId": "Rr64ma-U_HseoPrs6y0iiw", "expirationDateTime": "2014-12-03T18:30:49.460Z", "input": { "documentFileId": "5qTYa3gzN9gYUb5SzqUhqg", "markupFileId": " o1bLJwFGxf9QGuTkyrOqig" }, "state": "complete", "percentComplete": 100, "output": { "documentFileId": "5ufb3ytUb1BxxgSUAk_G9Q" }, "affinityToken": "rcqmuB9pAa8+4V7fhO1SXzawy/YMQU1g8lLdNDe5l7w=" } // 5. Get the burned document once the markup burning process is complete GET http://192.168.0.1:18682/PCCIS/V1/WorkFile/5ufb3ytUb1BxxgSUAk_G9Q Accusoft-Affinity-Token: rcqmuB9pAa8+4V7fhO1SXzawy/YMQU1g8lLdNDe5l7w= 200 OK Content-Type: application/pdf [binary data] |